BUY AN ITEM
by Al Staffieri Jr.


This is a simple script to buy an item. In this example, sword is the item to buy and it costs 30 gold. This checks to see if you already have the sword and if you have enough gold to buy it. If you can buy it, then 30 gold is subtracted and the sword variable is set to 1.

IF sword = 1 THEN
  ALERT You already have that!
ELSE
  IF gold < 30 THEN
    ALERT You don't have enough money to buy that.
  ELSE 
    gold = gold - 30
    ALERT Thank you, come again.
    sword = 1
  END IF
END IF
